/**
 * 截取字符串，并在末尾添加省略号
 * @param str
 * @param n
 * @returns {string|*}
 */
export function truncateStringWithEllipse(str: string, n: number) {
  return str?.length > n ? str.substr(0, n - 1) + '…' : str
}

/**
 * 截取字符串
 * @param str
 * @param n
 * @returns {string|string|any|string}
 */
export function truncateString(str: string, n: number) {
  return str?.length > n ? str.substr(0, n - 1) : str
}
